#!/bin/bash
set -e

cd $(dirname $0)/..

echo Running: go fmt	
test -z "$(go fmt ./... | tee /dev/stderr)"

echo Running: go vet	
test -z "$(go vet ./... 2>&1 | tee /dev/stderr)"

echo Running: golint	
test -z "$(go list ./... | grep -v /vendor/ | xargs -L1 golint | grep -v 'or be unexported' | tee /dev/stderr)"

echo Running: goimports
test -z "$(goimports -d $(find . -type f -name '*.go' -not -path "./vendor/*") | tee /dev/stderr)"
